package com.broada.apm.utils;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CachedItemManager {
	private static final CachedItemManager CACHED_ITEM_MANAGER = new CachedItemManager();
	private static Logger LOG = LoggerFactory.getLogger(CachedItemManager.class);
	private static Map<String, HashMap<?, ?>> cachedMaps = new HashMap<String, HashMap<?, ?>>();
	private CachedItemManager() {

	}
	public static CachedItemManager getInstance() {
		return CACHED_ITEM_MANAGER;
	}
	public <KA,VA> Map<KA,VA> getManager(String name) {
		if(!cachedMaps.containsKey(name)){
			HashMap<KA,VA> value = new HashMap<KA, VA>();
			cachedMaps.put(name, value);
		}
		return (Map<KA, VA>) cachedMaps.get(name);
	}
}
